<?php
//check if admin login
if (!isset($_SESSION['user'])) {
    header("Location: login.php");
}

//logout
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
    unset($_SESSION['user']);
    header("Location: login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Dashboard - Admin</title>

        <!-- Bootstrap core CSS -->
        <link href="../css/bootstrap.min.css" rel="stylesheet"/>

        <!-- Add custom CSS here -->
        <link href="../css/admin.css" rel="stylesheet"/>
    </head>

    <body>

        <div id="wrapper">

            <!-- Sidebar -->
            <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="">Dashboard - Admin</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse navbar-ex1-collapse">
                    <ul class="nav navbar-nav side-nav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-caret-square-o-down"></i> Admin Settings <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="index.php">Manege Options</a></li>
                                <li><a href="metas.php">Manege Meta</a></li>
                                <li><a href="emails.php">Manege Emails</a></li>
                                <li><a href="urls.php">Manage Admin Urls</a></li>
                            </ul>
                        </li>
                        <li><a href="members.php"><i class="fa fa-bar-chart-o"></i> Members</a></li>
                        <li><a href="advertising.php"><i class="fa fa-bar-chart-o"></i> Advertising </a></li>
                        <li><a href="banners.php"><i class="fa fa-bar-chart-o"></i> Banners</a></li>
                        <li><a href="sponsors.php"><i class="fa fa-bar-chart-o"></i> Sponsor Ads</a></li>
                        <li><a href="email-users.php"><i class="fa fa-bar-chart-o"></i> E-mail Users</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-caret-square-o-down"></i> Edit your Pages <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="edit-page.php?page=ad_purchase_thankyou_page">Ad Purchase Thankyou Page</a></li>
                                <li><a href="edit-page.php?page=home_page">Home Page</a></li>
                                <li><a href="edit-page.php?page=logout_page">Logout Page</a></li>
                                <li><a href="edit-page.php?page=member_area_home_page">Members Area Home Page</a></li>
                                <li><a href="edit-page.php?page=terms_page">Terms Page</a></li>
                                <li><a href="edit-page.php?page=footer_page">Website Footer</a></li>
                                <li><a href=""></a></li>
                            </ul>
                        </li>
                    </ul>

                    <ul class="nav navbar-nav navbar-right navbar-user">
                        <li class="dropdown user-dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> Hello Admin <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a href="index.php?action=logout"><i class="fa fa-power-off"></i> Log Out</a></li>
                            </ul>
                        </li>
                    </ul>
                </div><!-- /.navbar-collapse -->
            </nav>